package com.hmall.feign.client;

import com.hmall.user.pojo.Address;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient("userservice")
public interface UserClient {
    //@RequestHeader：调用此方法，需要传入userId，feign会将值以请求头的方式携带
    @GetMapping("/address/{id}")
    Address findAddressById(@PathVariable("id") Long id,
                            @RequestHeader(name = "Authorization") String userId);
}
